import UIAbility from '@ohos.app.ability.UIAbility';
import hilog from '@ohos.hilog';
import window from '@ohos.window';
import { XLog, Tmmkv } from 'xwork'
import deviceInfo from '@ohos.deviceInfo';
import fileUri from '@ohos.file.fileuri';

export default class EntryAbility extends UIAbility {
  onCreate(want, launchParam) {
    XLog.info('Ability onCreate');


  }

  onDestroy() {
    XLog.info('Ability onDestroy');
  }

  onWindowStageCreate(windowStage: window.WindowStage) {
    // Main window is created, set main page for this ability
    XLog.error('Ability onWindowStageCreate');
    windowStage.loadContent('pages/LaunchPage', (err, data) => {
      if (err.code) {
        XLog.error(JSON.stringify(err) ?? '');
        return;
      }
      XLog.info(JSON.stringify(data) ?? '');
    });
  }

  onWindowStageDestroy() {
    // Main window is destroyed, release UI related resources
    XLog.info('Ability onWindowStageDestroy');
  }

  onForeground() {
    // Ability has brought to foreground
    XLog.info('Ability onForeground');
  }

  onBackground() {
    // Ability has back to background
    hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
  }
}
